/*
 * L298N.c
 * 
 * 
 */

#include "IR.h"
#include "L298N.h"

void wiringPiStart(void)
{
	wiringPiSetup();
	//IR_Setup();
	Motor_Setup();
}

int main(int argc, char **argv)
{
	char ch = 0;
	wiringPiStart();
	while(1){
	printf("控制器：");
	scanf("%c",&ch);
	while(getchar() !='\n');
	if(ch == 'w') Motor_Forward();
	else if(ch =='s') Motor_Backward();
	else if(ch =='q') speedUp();
	else if(ch =='e') speedDown();
	else if(ch =='t') Motor_Stop();
	else if(ch =='a') Motor_Left();
	else if(ch =='d') Motor_Right();
	else if(ch =='z') {GPIO_Cleanup();return 0;}
	
	

	/*if(IR_ReadData())
		{
			
			if(IR_code[2] == 0x45) Motor_Forward();
			if(IR_code[2] == 0x46) Motor_Stop();
			if(IR_code[2] == 0x47) Motor_Backward();
			if(IR_code[2] == 0x40) speedDown();
			if(IR_code[2] == 0x43) speedUp();
			if(IR_code[2] == 0x44) {GPIO_Cleanup();return 0;}
		}*/
	//	delay(500);
	}
	return 0;
}

